﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using XinjeMesProgram.Entities.RoleAndUser;

namespace XinjeMesProgram.Entities.RoleAndUser
{
    /// <summary>
    /// 菜单实体类
    /// </summary>
    public class AuthMenu
    {
        /// <summary>
        /// GUID
        /// </summary>
        [Key, Required]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Column(TypeName = "nvarchar(50)")]
        public string Guid { get; set; }

        /// <summary>
        /// 菜单名称
        /// </summary>
        [Required, Column(TypeName = "nvarchar(50)")]
        public string Name { get; set; }

        /// <summary>
        /// 链接地址
        /// </summary>
        [Column(TypeName = "nvarchar(255)")]
        public string Url { get; set; }

        /// <summary>
        /// 页面别名
        /// </summary>
        [Column(TypeName = "nvarchar(100)")]
        public string Alias { get; set; }

        /// <summary>
        /// 菜单图标(可选)
        /// </summary>
        [Column(TypeName = "nvarchar(50)")]
        public string Icon { get; set; }

        /// <summary>
        /// 父级GUID
        /// </summary>
        [Column(TypeName = "nvarchar(50)")]
        public string ParentGuid { get; set; }

        /// <summary>
        /// 上级菜单名称
        /// </summary>
        [Column(TypeName = "nvarchar(50)")]
        public string ParentName { get; set; }

        /// <summary>
        /// 菜单层级深度
        /// </summary>
        public int Level { get; set; }

        /// <summary>
        /// 描述信息
        /// </summary>
        [Column(TypeName = "nvarchar(200)")]
        public string Description { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 是否可用(0:禁用,1:可用)
        /// </summary>
        public CommonEnum.Status Status { get; set; }

        /// <summary>
        /// 是否已删
        /// </summary>
        public CommonEnum.IsDeleted IsDeleted { get; set; }

        /// <summary>
        /// 是否为默认路由
        /// </summary>
        public CommonEnum.YesOrNo IsDefaultRouter { get; set; }

        /// <summary>
        /// 菜单拥有的权限列表
        /// </summary>
        [NotMapped]
        public ICollection<AuthPermission> Permissions { get; set; }
    }
}